
#include "flv_information.h"
#include "flv_parser.h"
#include <cstdint>
#include <cstdio>
#include <fcntl.h>
#include <sys/file.h>
#include <unistd.h>
#include <ctime>
#include <errno.h>

void ReadFromFileData()
{
	// only has video stream
	const std::string filename = "/home/hjie/download/filesample/sample_1280x720.flv";
	int file_fp = open(filename.c_str(), O_RDONLY, 0666);
	if (file_fp < 0)
	{
		printf("open file failed name : %s.\n", filename.c_str());
		return;
	}
	uint8_t data[65535] = {0};
	int size = read(file_fp, data, sizeof(data) - 1);
	FlvParser flv_parser;
	int use_length = 0;
	FlvHeader header;
	flv_parser.ParserFlvHeaderData(data, size, use_length, &header);
	header.PrintInfo();
	close(file_fp);
}

int main(int argc, const char * argv[])
{
	ReadFromFileData();
	return 0;
}